#pragma once

#include "rotor-light.hpp"
#include "string_view"
#include <cstdint>
#include <cmath>

namespace rl = rotor_light;

namespace message {

struct LogStatic : rl::Message {
  static constexpr rl::MessageTypeId type_id = __LINE__;
  LogStatic(rl::ActorId to, const char *message);
  std::string_view string;
};

struct LogDynamic : rl::Message {
  static constexpr rl::MessageTypeId type_id = __LINE__;
  static constexpr auto SZ = 20;
  LogDynamic(rl::ActorId to, const char *message, uint_fast8_t size);
  char data[SZ];
  uint_fast8_t size;
};

struct LogCommit : rl::Message {
  static constexpr rl::MessageTypeId type_id = __LINE__;
  using rl::Message::Message;
};

struct RequestHT : rl::Message {
  static constexpr auto type_id = __LINE__;
  using Message::Message;
};

struct ResponseHT : rl::Message {
  static constexpr auto type_id = __LINE__;

  ResponseHT(rl::ActorId to, float t = NAN, float h = NAN)
      : Message(to), temperature{t}, humility{h} {}

  float temperature;
  float humility;
};


} // namespace message

using Storage =
    rl::traits::MessageStorage<rl::message::ChangeState,
                               rl::message::ChangeStateAck,
                               rl::message::RefreshTime,
                               message::LogStatic,
                               message::LogDynamic>;
